package com.bing.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Created by kaibb on 15-11-28.
 */
public interface BaseDao<T, PK extends Serializable> {

    PK save(T entity);
    T merger(T entity);

    void update(T entity);

    void delete(T entity);

    void delete(PK pk);

    T findById(PK id);

    List<T> findByHQL(String hql, Map<String, Object> params);

    Object findByHQLOne(String hql, Map<String, Object> params);

    List<T> findByPage(int page, int pageSize, String hql, Map<String, Object> params);

    T findFirst(String hql, Map<String, Object> params);

    List findBySQL(int page, int pageSize, String sql, Map<String, Object> params);
}